package cate.game.role.pay.trademall.oncefund.msg;

import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBTradeMall;
import easy.java.dev.note.NoteField;
import easy.java.practice.errorcode.EcResult;

@ClientMsg(title = "交易坊-一次性基金 一键领取")
public class OnceFundOneClickReceiveRewardReq implements MsgInput {
    @NoteField(value = "基金模板ID")
    public int tid;

    @Override
    public MsgConfig conf() {
        return MsgIdBTradeMall.TRADE_MALL_ONCE_FUND_ONE_CLICK_RECEIVE_REQ;
    }

    @Override
    public void execute(GameBody game, ClientContext cc) {
        EcResult<Void> r = cc.getRole().getPay().tradeMall.once_fund_all.oneClickReceiveFundReward(tid);
        if (r.ok()) {
            cc.getRole().getPay().tradeMall.once_fund_all.noticeUpdate();
        } else {
            game.notice.message(cc.getRole(), r.message);
        }
    }
}
